package com.rw.coco.handler.message.event;

import com.rw.coco.api.data.CocoDataApi;
import com.rw.coco.api.event.MessageEvent;
import com.rw.coco.api.event.PrivateMessageEvent;

/**
 * 可可私聊消息对象
 */
public class CocoPrivateMessageEvent extends CocoMessageEvent {
    private final PrivateMessageEvent privateMessage;

    public CocoPrivateMessageEvent(PrivateMessageEvent privateMessage, CocoDataApi dataApi) {
        super(privateMessage, dataApi);
        this.privateMessage = privateMessage;
    }

    @Override
    public boolean isBlack() {
        return !accountModel.isSuperAdmin() && accountModel.isBlackList();
    }

    @Override
    public MessageEvent getMessageEvent() {
        return getPrivateMessage();
    }

    public PrivateMessageEvent getPrivateMessage() {
        return privateMessage;
    }

    /**
     * 删除好友，如果是群临时会话则无效
     */
    public void delete() {
        getPrivateMessage().delete();
    }
}
